<?php
include_once "common.php";
if(isset($_GET['code']) && !empty($_GET['code']))
{
	$query = "SELECT * FROM Customers WHERE ActivatieCode = '".str_replace("'","&#39;",$_GET['code'])."'";
	$result = $_MySQL->runQuery($query);
	if(mysql_num_rows($result) >= 1)
	{
		$row = mysql_fetch_assoc($result);
		$query = "	UPDATE Customers SET 
							Status = '1',
							ActivatieDatum = NOW(),
							ActivatieIP = '".str_replace("'","&#39;",$_SERVER['REMOTE_ADDR'])."',
							ActivatieCode = ''
					WHERE ActivatieCode = '".str_replace("'","&#39;",$_GET['code'])."'";
		$_MySQL->runQuery($query);
		
		// login...
		$_SESSION['login'] = $row; 
		
		header("Location: http://webshop.prijsgezocht.nl", TRUE, 301);
	}
	else
	{
		include_once "header.php";
		?>
		<br /><br /><br />Er ging iets mis met het bevestigen van uw e-mailadres
		<br />Code wordt niet gevonden
		<br /><br /><br />
		<?php
		include_once "footer.php";
	}
}
else
{
	include_once "header.php";
	?>
	<br /><br /><br />Er ging iets mis met het bevestigen van uw e-mailadres
	<br /><br /><br />
	<?php
	include_once "footer.php";
}